package com.heima.feignclient.client;

import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.article.dtos.AuthorDto;
import com.heima.model.media.dtos.WmNewsResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("leadnews-article")
public interface ArticleFeign {

    /**
     * 保存作者
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/author/save")
    Integer saveAuthor(@RequestBody AuthorDto dto);


    /**
     * 保存文章数据
     * @param dto
     * @return  文章articleId
     */
    @PostMapping("/api/v1/article/save")
    Long saveArticle(@RequestBody WmNewsResultDTO dto);

    /**
     * 分页查询 文章列表
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/api/v1/article/findByPage")
    List<ArticleDto> findByPage(@RequestParam(name = "page")Integer page,
                                       @RequestParam(name = "size")Integer size);
}
